package work.stackandqueque;

import java.util.Stack;

public class Problem155 {
    class MinStack {

        Stack<int[]> A;

        public MinStack() {
            A = new Stack<>();
            int[] a = {0, Integer.MAX_VALUE};
            A.add(a);
        }

        public void push(int val) {
            int min = Math.min(val, getMin());
            int[] a  ={val,min};
            A.push(a);
        }

        public void pop() {
            A.pop();
        }

        public int top() {
            return A.peek()[0];
        }

        public int getMin() {
            return A.peek()[1];
        }
    }
}
